﻿// -------------------------------------------------------------------------
//    @FileName         :    NFLoginNoticeData.h
//    @Author           :    gaoyi
//    @Date             :    24-8-28
//    @Email            :    445267987@qq.com
//    @Module           :    NFLoginNoticeData
//
// -------------------------------------------------------------------------

#pragma once

#include <NFServerComm/NFServerCommon/NFDBGlobalTemplate.h>
#include "proto_db.nanopb.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

class NFPlayer;
class NFLoginNoticeData : public NFDBGlobalTemplate<NFLoginNoticeData, proto_ff::tbLoginNoticeData, EOT_LOGIC_LOGIN_NOTICE_DATA_ID>
{
public:
    NFLoginNoticeData();
    
    virtual ~NFLoginNoticeData();
    
    int CreateInit();
    int ResumeInit();
public:
    int AfterAllConnectAndAllDescStore(NF_SERVER_TYPE serverType) override;
public:
    virtual int LoadFromDB(const proto_ff::tbLoginNoticeData &dbData);

    virtual int SaveToDB(proto_ff::tbLoginNoticeData &dbData);

    virtual int InitConfig();

    virtual int GetDbId();
public:
    int SetLoginNoticeData(uint64_t begin_time, uint64_t end_time, const std::string& title, const std::string& notice, int index, bool is_pop);

    int OnPlayerLogin(NFPlayer * pPlayer);
public:
    tbLoginNoticeData *GetData() { return &m_stData; }

private:
    bool has_predefine_notice;
    tbLoginNoticeData m_stData;
};